#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 20
int main(int argc, char *argv[])
{
	FILE *fp;
	char words[LEN];
	if(argc != 3)
	{
		fprintf(stderr, "input wrong\n");
		exit(EXIT_FAILURE);
	}
	if((fp = fopen(argv[2], "r")) == NULL)
	{
		fprintf(stderr, "can not open the file\n");
		exit(EXIT_FAILURE);
	}
	while((fgets(words, LEN, fp)) != NULL)
	{
		if(strstr(words, argv[1]) != NULL)
			fputs(words, stdout);
	}
	if(fclose(fp) != 0)
		fprintf(stderr, "close file failed\n");
	puts("DONE!");
	return 0;	
} 
